﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TEST02
{
    //包括的属性有姓名name，年龄age，学位degree。
    //由学生类Student
    //派生出专科生类Specialty和本科生类Undergraduate
    //专科生类包含的属性有专业spec,
    //本科生类包括的属性有研究方向drec。
    //每个类都有相关数据的输出方法。最后在一个测试类中对设计的类进行测试。 
    //要求测试结果如下：
    class Student
    {
        protected string name;
        protected int age;
        protected string degree;
        public Student(string name, int age, string degree)
        {
            this.name = name;
            this.age = age;
            this.degree = degree;
        }
    }
    class Specialty : Student
    {
        public string spec;
        public Specialty(string name, int age, string degree, string spec) : base(name, age, degree)
        {
            this.spec = spec;
        }
        public void GetOut()
        {
            Console.WriteLine("姓名：{0}\n年龄：{1}\n学位：{2}\n专业：{3}", name, age, degree, spec);
        }
    }
    class Undergraduate : Student
    {
        public string drec;
        public Undergraduate(string name, int age, string degree, string drec) : base(name, age, degree)
        {
            this.drec = drec;
        }
        public void GetOut()
        {
            Console.WriteLine("姓名：{0}\n年龄：{1}\n学位：{2}\n专业：{3}", name, age, degree, drec);
        }
    }
}
